<?php

namespace App\Http\Controllers\Extra;

use App\Jobs\SendMsg;
use Carbon\Carbon;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\DB;

class ZolController extends Controller
{
    //
    public function index()
    {
        // 植发论坛fid 13固定就行了
        $zhi = '13';
//        $data = DB::connection('bbs')->table('pre_forum_post as p')->join('xhjcdb_members as m','p.authorid','=','m.uid')
//            //->where('p.fid',$zhi)
//            //->whereBetween('dateline',[1482508800,1506182400])
//            ->limit(10)
//            ->select('p.*')
//            ->orderBy('dateline','DESC')
//            ->get();
        $data = DB::connection('bbs')->table('pre_forum_post')->limit(10)->orderBy('dateline','DESC')->get();

        dd($data);
    }
    //测试一个队列任务
    public function queue()
    {
        $job = (new SendMsg())->delay(Carbon::now()->addMinutes(10));
        $job2 = (new SendMsg())->delay(Carbon::now()->addMinutes(10));
        $this->dispatch($job);
        $this->dispatch($job2);

        return 'delay queue done';
    }
}
